package com.app.couponsharelife.ui.listener

import com.scwang.smartrefresh.layout.api.RefreshFooter
import com.scwang.smartrefresh.layout.api.RefreshHeader
import com.scwang.smartrefresh.layout.api.RefreshLayout
import com.scwang.smartrefresh.layout.constant.RefreshState
import com.scwang.smartrefresh.layout.listener.OnMultiPurposeListener

/**
 *Created by xct on 2019/4/9
 *Description:下拉刷新监听
 */
interface MyMultiPurposeListener: OnMultiPurposeListener {
    override fun onFooterMoving(footer: RefreshFooter?, isDragging: Boolean, percent: Float, offset: Int, footerHeight: Int, maxDragHeight: Int) {

    }

    override fun onHeaderStartAnimator(header: RefreshHeader?, headerHeight: Int, maxDragHeight: Int) {
        //animationDrawable!!.start()
    }

    override fun onFooterReleased(footer: RefreshFooter?, footerHeight: Int, maxDragHeight: Int) {

    }

    override fun onStateChanged(refreshLayout: RefreshLayout, oldState: RefreshState, newState: RefreshState) {

    }

    override fun onHeaderMoving(header: RefreshHeader?, isDragging: Boolean, percent: Float, offset: Int, headerHeight: Int, maxDragHeight: Int) {
        //setAnima(percent)
        headerMoving(percent)
    }

    override fun onFooterFinish(footer: RefreshFooter?, success: Boolean) {

    }

    override fun onFooterStartAnimator(footer: RefreshFooter?, footerHeight: Int, maxDragHeight: Int) {

    }

    override fun onHeaderReleased(header: RefreshHeader?, headerHeight: Int, maxDragHeight: Int) {
        //animationDrawable!!.start()
        headerReleased()
    }

    override fun onLoadMore(refreshLayout: RefreshLayout) {
        //getGoodsList(false)
        loadMore()
    }

    override fun onRefresh(refreshLayout: RefreshLayout) {
        /*pageIndex=1
        getGoodsList(true)*/
        refresh()
    }

    override fun onHeaderFinish(header: RefreshHeader?, success: Boolean) {
        /*hotsale_refreshimg.setImageResource(R.drawable.refresh_0)
        animationDrawable!!.stop()*/
        headerFinish()
    }
    fun headerReleased()
    fun headerMoving(percent: Float)
    fun headerFinish()
    fun loadMore()
    fun refresh()
}